/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.iceberg.adgt.ui.popup;

import com.iceberg.adgt.common.DomainException;
import com.iceberg.adgt.domain.ArchitectureDTO;
import com.iceberg.adgt.domain.DomainFacade;
import com.iceberg.adgt.domain.DomainFacadeImpl;
import com.iceberg.adgt.domain.StructureDTO;


/**
 * @author Tim Hofman Laptop
 */
public final class PopupControllerImpl implements PopupController {

	private final DomainFacade facade;
	private final ArchitectureDTO architecture;
	private final StructureDTO structure;

	public PopupControllerImpl() {
		this.facade = DomainFacadeImpl.getInstance();
		this.architecture = facade.getArchitecture();
		this.structure = facade.getStructure();
	}

	@Override
	public void setArchitectureName(String name) throws DomainException {
		this.facade.setArchitectureName(name);
	}

	@Override
	public void setArchitectureAuthor(String name) throws DomainException {
		this.facade.setArchitectureAuthor(name);
	}

	@Override
	public void setStructureName(String name) throws DomainException {
		this.facade.setStructureName(name);
	}

	@Override
	public void setStructureAuthor(String name) throws DomainException {
		this.facade.setStructureAuthor(name);
	}

	@Override
	public String getArchitectureName() {
		if (architecture.getName() != null) {
			return this.architecture.getName();
		}
		return "";
	}

	@Override
	public String getArchitectureAuthor() {
		if (architecture.getAuthor() != null) {
			return this.architecture.getAuthor();
		}
		return "";
	}

	@Override
	public String getStructureName() {
		if (structure.getName() != null) {
			return this.structure.getName();
		}
		return "";
	}

	@Override
	public String getStructureAuthor() {
		if (structure.getAuthor() != null) {
			return this.structure.getAuthor();
		}
		return "";
	}
}
